{% include 'header.html' %}

{% macro part_section(part, part_number, chapter_start) -%}
  <h2><span class="num">{{ part_number }}.</span><a href="{{ part.name | file }}.html" name="{{ part.name | file }}">{{ part.name }}</a></h2>
  <ul>
  {% for chapter in part.chapters %}
    <li><span class="num">{{ chapter_start + loop.index0 }}.</span><a href="{{ chapter.name | file }}.html">{{ chapter.name }}</a>
    {% if not chapter.done != False %}
      <a class="not-written" href="#not-written" title="This chapter hasn't been written yet!">(COMING SOON)</a>
    {% endif %}
    </li>
    {% if chapter.design_note %}
    <li class="design-note">
    <span class="num">&nbsp;</span><a href="{{ chapter.name | file }}.html#design-note">Design Note: {{ chapter.design_note }}</a>
    </li>
    {% endif %}
  {% endfor %}
  </ul>
{%- endmacro %}

{% macro navigation() -%}
  <h2><a href="#top"><small>&nbsp;</small> Table of Contents</a></h2>
  <ul>
    <li><a href="#welcome"><small>I</small>Welcome</a></li>
    <li><a href="#a-tree-walk-interpreter"><small>II</small>A Tree-Walk Interpreter</a></li>
    <li><a href="#a-bytecode-virtual-machine"><small>III</small>A Bytecode Virtual Machine</a></li>
    <li><a href="#backmatter"><small>&#10087;</small>Backmatter</a></li>
  </ul>
  {% include 'prev-next.html' %}
{%- endmacro %}

<nav class="wide">
  <a href="/"><img src="image/logotype-small.png" title="Crafting Interpreters"></a>
  <div class="contents">
    {{ navigation() }}
  </div>
</nav>

<nav class="narrow">
<a href="/"><img src="image/logotype-small.png" title="Crafting Interpreters"></a>
{% if prev %}
<a href="{{ prev|file }}.html" title="{{ prev }}" class="prev">←</a>
{% endif %}
{% if next %}
<a href="{{ next|file }}.html" title="{{ next }}" class="next">→</a>
{% endif %}
</nav>

<div class="page">
<div class="nav-wrapper">
<nav class="floating">
  <a href="/"><img src="image/logotype-small.png" title="Crafting Interpreters"></a>
  <div class="expandable">
    {{ navigation() }}
  </div>
  <a id="expand-nav">≡</a>
</nav>
</div>

<article class="contents">

<h1 class="part">{{title}}</h1>

<div class="sign-up" id="not-written">
  <h1>This book is a work in progress!</h1>
  <p>If you want to know when new chapters are done, join the mailing list:</p>

  <!-- Begin MailChimp Signup Form -->
  <div id="mc_embed_signup">
  <form action="//gameprogrammingpatterns.us7.list-manage.com/subscribe/post?u=0952ca43ed2536d6717766b88&amp;id=6e96334109" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
    <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="Your email address" required>
    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
    <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_0952ca43ed2536d6717766b88_6e96334109" tabindex="-1" value=""></div>
    <input type="submit" value="Sign me up!" name="subscribe" id="mc-embedded-subscribe" class="button">
  </form>
  </div>
  <!--End mc_embed_signup-->
  <p class="small">(I post about once a month. Don&#8217;t worry, I won&#8217;t spam you.)</p>
</div>

{{ part_section(toc[1], "I", 1) }}
{{ part_section(toc[2], "II", 4) }}
{{ part_section(toc[3], "III", 14) }}

<h2><span class="num">&#10087;</span><a href="backmatter.html" name="backmatter">Backmatter</a></h2>
<ul>
  <li><span class="num">A1.</span><a href="appendix-i.html">Appendix I: Lox Grammar</a></li>
  <li><span class="num">A2.</span><a href="appendix-ii.html">Appendix II: Generated Syntax Tree Classes</a></li>
</ul>

<footer>
  <a href="{{ next|file }}.html" class="next">
    First {{ next_type }}: &ldquo;{{ next }}&rdquo; &rarr;
  </a>
Hand-crafted by Robert Nystrom&ensp;&mdash;&ensp;<a href="https://github.com/munificent/craftinginterpreters/blob/master/LICENSE" target="_blank">&copy; 2015&hairsp;&ndash;&hairsp;2018</a>
</footer>
</article>

{% include 'footer.html' %}
